function post(callback) {
  var iSrc = 'http://as18/test.html'
  var iframe = document.createElement('iframe')
  iframe.style.width = '0'
  iframe.style.height = '0'

  iframe.setAttribute('src', iSrc)
  iframe.onload = function () {
    window.addEventListener('message', handleMessage)
  }
  document.body.appendChild(iframe)

  function handleMessage(event) {
    const message = event.data
    callback(message)
    console.log(event.origin)
  }
  function sendMessage(message) {
    iframe.contentWindow.postMessage(message, '*')
  }
  const iBeforeUnmount = function () {
    window.removeEventListener('message', handleMessage)
  }
  return { iBeforeUnmount, sendMessage }
}
export default post
